<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript">
        // Date对象 
        console.log(Date.now());
        console.log(new Date());
        // 创建Date对象
        console.log("----------Date对象----------");
        var d = new Date(); //默认当前时间
        console.log(d);
        var d2 = new Date("01/01/2024 10:00:01"); //指定时间 format: month/day/year hour:minute:second
        var d3 = new Date(2024,0,1,1,1,1,1); //指定时间 format: new Date(year, monthIndex, day, hours, minutes, seconds, milliseconds)
        console.log(d2);
        console.log(d3);
        //getDate(): 获取日期
        console.log("----------getDate()----------");
        console.log(d.getDate());
        //getDay(): 获取星期几
        console.log("----------getDay()----------");
        console.log(d.getDay());
        //getUTCDate getUTCDay: 获取UTC几号/周几
        console.log("----------getUTCDate()----------");
        console.log(d.getUTCDate());
        console.log(d.getUTCDay());
        //getMonth(): 获取月份
        console.log("----------getMonth()----------");
        console.log(d.getMonth()); //0-11 
        //getFullYear(): 获取年份
        console.log("----------getFullYear()----------");
        console.log(d.getFullYear());
        //getTime(): 获取时间戳[毫秒数]
        console.log("----------getTime()----------");
        console.log(d.getTime());
        //getHours(): 获取小时
        console.log("----------getHours()----------");
        console.log(d.getHours());
        //getMinutes(): 获取分钟
        console.log("----------getMinutes()----------");
        console.log(d.getMinutes());
        //getSeconds(): 获取秒
        console.log("----------getSeconds()----------");
        console.log(d.getSeconds());
        //getMilliseconds(): 获取毫秒
        console.log("----------getMilliseconds()----------");
        console.log(d.getMilliseconds());
        
    


    </script>
</head>
<body>
    
</body>
</html>